﻿@{
    ViewBag.Title = "应用系统配置";
    Layout = "~/Views/Shared/_LayoutPageBaseEdit.cshtml";
}
<div class="box-body">
    <div class="col-md-12">
        <div class="form-group">
            <label class="col-sm-3 control-label m">代码</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "Code",
                    Value = @Model.Code,
                    Placeholder = "代码",
                    Required = true,
                    NotemptyMessage = "请输入代码",
                    Remote = true,
                    RemoteUrl = "/System/App/CheckAppCode?id=" + @Model.AppId,
                    RemoteMessage = "已存在改代码,请重新确认后重试",
                    StringLength = true,
                    StringLengthMin = 1,
                    StringLengthMax = 64,
                    StringLengthMessage = "长度1-64"
                })
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label m">全称</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "Name",
                    Value = @Model.Name,
                    Placeholder = "全称",
                    Required = true,
                    NotemptyMessage = "请输入全称",
                    StringLength = true,
                    StringLengthMin = 1,
                    StringLengthMax = 512,
                    StringLengthMessage = "长度1-512"
                })
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label m">简称</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "ShortName",
                    Value = @Model.ShortName,
                    Placeholder = "简称"
                })
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">域名/IP</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "Domain",
                    Value = @Model.Domain,
                    Placeholder = "域名/IP"
                })
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">发布路径Dll</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "DllPath",
                    Value = @Model.DllPath,
                    Placeholder = "发布路径Dll"
                })
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label m">排序号</label>
            <div class="col-sm-9">
                @Html.BootstrapText(new BootstrapBoxInput
                {
                    Name = "OrderNo",
                    Value = @Model.OrderNo,
                    Placeholder = "排序号",
                    Required = true,
                    NotemptyMessage = "请输入排序号",
                    Pattern = "^[0-9]*$",
                    RegexpMessage = "请输入数字"
                })
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">备注</label>
            <div class="col-sm-9">
                @Html.BootstrapTextArea(new BootstrapBoxInput
                {
                    Name = "Remark",
                    Value = @Model.Remark,
                    Placeholder = "备注"
                })
            </div>
        </div>
    </div>
</div>
@using EIP.Common.Entities.Dtos
@using EIP.Web.AdminLTE.DataUsers.Helpers
@model EIP.System.Models.Entities.SystemApp
@Html.HiddenFor(f => Model.AppId)
<script>
    $(function () {
        initPureClearButton();
        initForm();
        ValidformNeed();
    });

    function initForm() {
        //初始化控件
        var form = $("#editform").form();
        //数据校验
        $("#editform").formValidation({
            message: '请输入有效值',
            trigger: 'blur'
        }).on('success.form.fv', function (e) {
            UtilAjaxPostWait("/System/App/SaveApp", form.getFormSimpleData(), function (data) {
                if (DialogAjaxResult(data)) {
                    getGridData();
                    //关闭
                    dialog.close();
                }
                return false;
            });
            return false;
        });
    }

    function initPureClearButton() {
        $.each($("input:text, input:password, " +
                "input[type='email'], input[type='url'], input[type='search'], input[type='tel'], input[type='number'], " +
                "input[type='datetime'],textarea", $("#editform")),
            function (index, element) {
                var $element = $(element);
                if (($element.attr("data-pure-clear-button") == undefined || $element.attr("data-pure-clear-button") === 'false') && !$element.hasClass("has-pure-clear-button")) {
                    return;
                }
                $element.pureClearButton("create");
            });
    }
</script>